﻿using Entitas;

namespace Script.Systems
{
    public class DestorySystem : ICleanupSystem
    {
        private readonly Group<GameEntity> m_Group;

        public DestorySystem (Contexts contexts)
        {
            m_Group = (Group<GameEntity>) contexts.game.GetGroup (GameMatcher.DestoryComp);
        }
        
        public void Cleanup ()
        {
            foreach (var gameEntity in m_Group.GetEntities())
            {
                gameEntity.Destroy ();
            }
        }
    }
}